﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FastData
{
    public interface ISqlClient
    {

        string ConnStr { get; }
        string userid { get; set; }
        string password { get; set; }

        string database { get; set; }

        string datasource { get; set; }

        bool IsConnected { get; }
        bool SqlConn();
        bool SqlConnTest();
        void CaculateStartEnd(string tablename, int lastcount, out int _start, out int _end);
        string gen_SQL_tb_last(string tablename, int lastcount, string PrimaryKey = "Index");
        DataSet FindLastData(string tablename ,string PrimaryKey="Index");
        DataSet FindFirstData(string tablename);
        int DeleteData(string tableName, string[] columnName, object[] value);
        List<string> FindAllTables();
        DataSet FindLastLines(string tablename, int lastcount, string PrimaryKey="Index");
        DataSet FindAllLines(string tablename);
        List<string> FindAllTableColums(string tablename);
        DataSet FindAllLike(string tablename, int lastcount, string column, object like);
        bool SqlClose();
        bool CheckStates();
        bool CheckStatesAndReconnection();
        bool InsertData(string sql_command);
        bool Insert(string tableName, string[] columnNames, object[] values ,ref long id);
        bool InsertGluingSystemData(string tableName, string[] columnNames, List<string> values);
        bool InsertGluingSystemData(string tableName, string[] columnNames, List<object> values);
        DataSet GetDataSet(string sql_command);
        DataSet GetDataSet(string tableName, string columnName, string start, string end);
        DataSet GetData(string tableName, string columnName, string value);
        DataSet GetData(string tableName, string[] columnName, object[] value);

        DataSet GetNewData(string tableName, string[] columnName, object[] value);

        DataSet GetFirstData(string tableName, string[] columnName, object[] value);
        DataSet GetDataSet(string tableName, string columnName, string value);
        DataSet GetDataByPagination(string selectSql, int pageSize);
        bool Update(string sql_command);
        bool Update(string tableName, string column1Name, string value1);
        bool Update(string tableName, string column2Name, string value2, string column1Name, object value1);
        bool Update(string tableName, string[] column2Name, object[] value2, string[] column1Name, object[] value1);
        bool Update(string tableName, string[] column1Name, string[] value1, string column2Name, string value2, string column3Name, string value3);
        bool Delete(string sql_command);
        bool Delete(string tableName, string columnName, string value);
    }
}
